<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="com.hnas.core.util.PropertyUtil "%>
<%@page import="com.hnas.core.dto.DataBean"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${pageTitle}</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath }/static/common/multiple/easyui.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath }/static/common/multiple/jquery.easyui.min.js"></script>
	
<style type="text/css">
#ImportDataDiv select,#nodeId,#organTypeM{border: #dcdbdb 1px solid;height: 26px;width: 200px;border-radius: 3px;font-family: Microsoft YaHei;}
</style>
</head>
<body >
	<div class="titleBar m_b_20">
		<div class="tit fl b_l_e74a5f">
			<h3 class="cn">商户
			<c:if test="${type=='detail'}">
			        详情
			</c:if>
			<c:if test="${type=='edit'}">
			         编辑
			</c:if>
			<c:if test="${type=='add'}">
			         添加
			</c:if>
			</h3>
			<span class="en"> Merchant Management </span>
		</div>
		<div class="fr"></div>
	</div>
	<input type="text" name="saveStr" id="saveStr" value="${saveStr }" hidden="hidden" >
	<input type="text" name="msg" id="msg" value="${msg }" hidden="hidden" >
	<div id="editDIV" >
	<form action="${pageContext.request.contextPath }/backend/merchant/save" id="editFm" method="post" name="editFm" class="editFm" onsubmit="return submitFrom();" enctype="multipart/form-data" >
		<table >
		   <c:if test="${type=='edit'}">
			   <input type="text" name="typeStr" id="typeStr" value="商户编辑" hidden="hidden" >
			</c:if>
			<c:if test="${type=='add'}">
			   <input type="text" name="typeStr" id="typeStr" value="商户添加" hidden="hidden" >
			</c:if>
		   <input type="text" name="id" id="id" value="${dto.id }" hidden="hidden" >
		   <input type="text" name="createTime" id="createTime" value="${dto.createTime }" hidden="hidden" >
		   <input type="text" name="isDeleted" id="isDeleted" value="${dto.isDeleted }" hidden="hidden" >
 		   <tr>
 				<td width="160px;" align="right"> 
 					<label>商户名称：</label>  
 				</td>
 				<td>
 				   <input type="text" name="name" id="name" value="${dto.name }" style="width:450px" class="showContent" ><label style="color:red;">*</label>
 				</td>
 		   </tr>
 		   <tr>
 				<td width="160px;" align="right"> 
 					<label>商户图片：</label>  
 				</td>
 				<td>
 				   <input type="text" name="pic" id="pic" style="width:450px" value="${dto.pic }" hidden="hidden">
 				   <img width="160" height="90" alt="${dto.pic }" src="${pageContext.request.contextPath}${dto.pic }"><br/>
 				   <span>${dto.pic }</span> <br/>
 				   <input type="file" name="merchant_pic" id="merchant_pic" style="width:450px" class="showContent" >
 				</td>
 		   </tr>
 		   <tr>
 				<td width="160px;" align="right"> 
 					<label>排序：</label>  
 				</td>
 				<td>
 				  <input type="text" name="sort" id="sort" value="${dto.sort }" style="width:450px" class="showContent" ><label style="color:red;">*</label>
 				</td>
 		   </tr>
			<tr>
      			<td colspan="2">
          			<p class="validateTips_deal" align="center"></p>
      			</td>
    		</tr>
		</table>
	</form>
	
</div>
<table class="tb_style02" width="100%">
			<tr>
			    <th style="width:100px;" hidden="hidden"></th>
               	<td style="width:100px;">
               		
                </td> 
               <td style="width:70px;">
   					<input class="btn_brown02 m_r_12" type="button" name="save" id="save" value="保 存">
        		</td>
        		 <td style="width:70px;">
   					<input class="btn_brown02 m_r_12" type="button" name="cancel" id="cancel" value="返 回">
        		</td> 
        		<th style="width:200px;" hidden="hidden"></th>
               	<td style="width:200px;">
               		
                </td>
			</tr>
		</table>

<script>
function saveReturn(){
	var saveStr = $("#saveStr").val();
	if(saveStr!=""){
		if(type=='add')
		showDetail()
		$.dialog.alert({title: $("#typeStr").val(),content:$("#msg").val()});
		 $("#saveStr").val('');
	}
}

window.onload = function(){};  

//保存和取消跳转
$("#cancel").click(function(){
	window.location.href= "${pageContext.request.contextPath }/backend/merchant/search";
})

$("#save").click(function(){
     $("#editFm").submit();
})

  function isNotEmpty(str){
		if(str!=null&&str!=''&&str!=undefined){
			return true;
		}
		return false;
	}

function submitFrom(){
	var name = $("#name").val();
	if(!isNotEmpty(name)){
		 $.dialog.alert({title:"温馨提示",content:("名称不能为空！")});
		 return false;
	} 
	return true;
}
	
</script>
</body>
</html>